package com.hunter.common.base;

import org.apache.ibatis.annotations.Param;


import java.util.List;

/**
 * BaseService接口
 * Created by hunter on 2017/6/5.
 */
public interface BaseService<Record, Example> {

	int countByExample(Example example);

	int deleteByExample(Example example);

	int deleteByPrimaryKey(Long id);

	long insert(Record record);

	long insertSelective(Record record);

	List<Record> selectByExampleWithBLOBs(Example example);

	List<Record> selectByExample(Example example);

//	List<Record> selectByExampleWithBLOBsForStartPage(Example example, Integer pageNum, Integer pageSize);
	
	PageBean<Record> selectByExampleWithBLOBsForStartPage(Example example, Integer pageNum, Integer pageSize, boolean count);

//	List<Record> selectByExampleForStartPage(Example example, Integer pageNum, Integer pageSize);

	PageBean<Record> selectByExampleForStartPage(Example example, Integer pageNum, Integer pageSize, boolean count);

//	List<Record> selectByExampleWithBLOBsForOffsetPage(Example example, Integer offset, Integer limit);
	
	PageBean<Record> selectByExampleWithBLOBsForOffsetPage(Example example, Integer offset, Integer limit, boolean count);

//	List<Record> selectByExampleForOffsetPage(Example example, Integer offset, Integer limit);
	
	PageBean<Record> selectByExampleForOffsetPage(Example example, Integer offset, Integer limit, boolean count);

	Record selectFirstByExample(Example example);

	Record selectFirstByExampleWithBLOBs(Example example);

	Record selectByPrimaryKey(Long id);

	int updateByExampleSelective(@Param("record") Record record, @Param("example") Example example);

	int updateByExampleWithBLOBs(@Param("record") Record record, @Param("example") Example example);

	int updateByExample(@Param("record") Record record, @Param("example") Example example);

	int updateByPrimaryKeySelective(Record record);

	int updateByPrimaryKeyWithBLOBs(Record record);

	int updateByPrimaryKey(Record record);

	int deleteByPrimaryKeys(String ids);

	void initMapper();

}